<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<script>
    $(document).ready(function(){
        $("#contentTable").treeTable();
    });
    function page(n,s){
        $("#pageNo").val(n);
        $("#pageSize").val(s);
        $("#settleSearch").submit();
        return false;
    }
    function printAcct(acctNo){
         var type=$("#acctType").val();
        if(type!=null && type=='0'){
            printPdf('${ctx}/finance/inpAcctMaster/printInpAcct','acctNo='+acctNo);
        }
        if(type!=null && type=='1'){
            printPdf('${ctx}/finance/patPrepayment/printPaymentAcct','acctNo='+acctNo);
        }
    }
</script>
<div class="app">
        <div class="content-wrap">
            <ul class="nav nav-tabs">
                <li class="active">
                    <a href="#">住院结账查询</a>
                </li>
            </ul>
            <div class="row" id="topDivId">
                    <section class="panel">
                        <div class="panel-body">
                            <div class="table-responsive no-border">
                                <div class="datatable-top">
                                    <div class="pull-left">
                                        <form id="settleSearch"  onsubmit="return loadDivForm('mainCenterDiv','settleSearch','${ctx}/finance/inpAcctMaster/acctSearch');" method="post" class="form-inline">
                                            <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
                                            <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
                                            <label>结账类型：</label>
                                            <select name="acctType" class="form-control" id="acctType">
                                                <option value="0" <c:if test="${inpAcctMaster.acctType=='0'}">selected="selected" </c:if>>住院结账</option>
                                                <option value="1" <c:if test="${inpAcctMaster.acctType=='1'}">selected="selected" </c:if>>预交金结账</option>
                                            </select>
                                            <label>结账日期：</label><input name="startDate" value="<fmt:formatDate value="${inpAcctMaster.startDate}" pattern="yyyy-MM-dd HH:mm:ss"></fmt:formatDate>"  id="startTime"  class="form-control Wdate" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>&nbsp;至
                                            <input name="endDate"value="<fmt:formatDate value="${inpAcctMaster.endDate}" pattern="yyyy-MM-dd HH:mm:ss"></fmt:formatDate>" id="endDate"  class="form-control Wdate" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>
                                            <label>收费人:</label><input name="createBy.name" value="${inpAcctMaster.createBy.name}" class="form-control">
                                            &nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
                                        </form>
                                    </div>
                                </div>
                            <table id="contentTable" class="table table-bordered mg-t datatable">
                                <thead>
                                  <tr>
                                      <th>结账序号</th>
                                      <th>收款员</th>
                                      <th>结账日期</th>
                                      <th>收据张数</th>
                                      <th>退费张数</th>
                                      <th>作废张数</th>
                                      <th>总费用</th>
                                      <th>总收入</th>
                                      <th>开始时间</th>
                                      <th>结束时间</th>
                                      <th>操作</th>
                                  </tr>
                                </thead>
                                <tbody>
                                 <c:forEach items="${page.list}" var="acctMaster" varStatus="ma">
                                   <tr id="${acctMaster.id}">
                                       <td>${acctMaster.acctNo}</td>
                                       <td>${acctMaster.user.name}</td>
                                       <td><fmt:formatDate value="${acctMaster.createDate}" pattern="yyyy-MM-dd HH:mm:ss"></fmt:formatDate></td>
                                       <td>${acctMaster.rcptsNum}</td>
                                       <td>${acctMaster.refundNum}</td>
                                       <td>${acctMaster.invalidNum}</td>
                                       <td>${acctMaster.sumAmount}</td>
                                       <td>${acctMaster.chargesAmount}</td>
                                       <td><fmt:formatDate value="${acctMaster.startDate}" pattern="yyyy-MM-dd HH:mm:ss"></fmt:formatDate></td>
                                       <td><fmt:formatDate value="${acctMaster.endDate}" pattern="yyyy-MM-dd HH:mm:ss"></fmt:formatDate></td>
                                       <td><a href="#" class="btn btn-primary btn-xs" onclick="printAcct('${acctMaster.acctNo}');">打印</a></td>
                                   </tr>
                                     <c:if test="${acctMaster.inpAcctDetailList.size()>0}">
                                         <tr id="${ma.count}" pid="${acctMaster.id}">
                                             <td colspan="6">
                                                 <table class="table table-bordered mg-t">
                                                     <tr>
                                                         <th>序号</th>
                                                         <th>收费类型</th>
                                                         <th>费用</th>
                                                         <th>收入</th>
                                                     </tr>
                                                     <c:forEach items="${acctMaster.inpAcctDetailList}" var="detail" varStatus="ss">
                                                         <tr>
                                                             <td> ${ss.count}</td>
                                                             <td> ${fns:getDictLabels(detail.subjCode, 'TALLY_SUBJECT_DICT', '')}</td>
                                                             <td> ${detail.costs}</td>
                                                             <td> ${detail.income}</td>
                                                         </tr>
                                                     </c:forEach>
                                                 </table>
                                             </td>
                                         </tr>
                                     </c:if>
                                 </c:forEach>
                                </tbody>
                            </table>
                            <div class="pagination">${page}</div>
                         </div>
                        </div>
                    </section>
            </div>
        </div>
</div>
</div>
</div>